<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>HttpDuplex - Documentation</title>

    <script src="scripts/prettify/prettify.js"></script>
    <script src="scripts/prettify/lang-css.js"></script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
</head>
<body>

<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
  <div class="navicon"></div>
</label>

<label for="nav-trigger" class="overlay"></label>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Git.html">Git</a><ul class='methods'><li data-type='method'><a href="Git.html#.close">close</a></li><li data-type='method'><a href="Git.html#.create">create</a></li><li data-type='method'><a href="Git.html#.exists">exists</a></li><li data-type='method'><a href="Git.html#.handle">handle</a></li><li data-type='method'><a href="Git.html#.list">list</a></li><li data-type='method'><a href="Git.html#.listen">listen</a></li><li data-type='method'><a href="Git.html#.mkdir">mkdir</a></li></ul></li><li><a href="HttpDuplex.html">HttpDuplex</a><ul class='methods'><li data-type='method'><a href="HttpDuplex.html#addTrailers">addTrailers</a></li><li data-type='method'><a href="HttpDuplex.html#cork">cork</a></li><li data-type='method'><a href="HttpDuplex.html#destroy">destroy</a></li><li data-type='method'><a href="HttpDuplex.html#end">end</a></li><li data-type='method'><a href="HttpDuplex.html#getHeader">getHeader</a></li><li data-type='method'><a href="HttpDuplex.html#pause">pause</a></li><li data-type='method'><a href="HttpDuplex.html#removeHeader">removeHeader</a></li><li data-type='method'><a href="HttpDuplex.html#resume">resume</a></li><li data-type='method'><a href="HttpDuplex.html#setDefaultEncoding">setDefaultEncoding</a></li><li data-type='method'><a href="HttpDuplex.html#setEncoding">setEncoding</a></li><li data-type='method'><a href="HttpDuplex.html#setHeader">setHeader</a></li><li data-type='method'><a href="HttpDuplex.html#uncork">uncork</a></li><li data-type='method'><a href="HttpDuplex.html#write">write</a></li><li data-type='method'><a href="HttpDuplex.html#writeContinue">writeContinue</a></li><li data-type='method'><a href="HttpDuplex.html#writeHead">writeHead</a></li><li data-type='method'><a href="HttpDuplex.html#writeHeader">writeHeader</a></li></ul></li><li><a href="Service.html">Service</a><ul class='methods'><li data-type='method'><a href="Service.html#.accept">accept</a></li><li data-type='method'><a href="Service.html#.reject">reject</a></li></ul></li></ul><h3>Modules</h3><ul><li><a href="module-lib_util.html">lib/util</a><ul class='methods'><li data-type='method'><a href="module-lib_util.html#~basicAuth">basicAuth</a></li><li data-type='method'><a href="module-lib_util.html#~createAction">createAction</a></li><li data-type='method'><a href="module-lib_util.html#~infoResponse">infoResponse</a></li><li data-type='method'><a href="module-lib_util.html#~noCache">noCache</a></li><li data-type='method'><a href="module-lib_util.html#~onExit">onExit</a></li><li data-type='method'><a href="module-lib_util.html#~parseGitName">parseGitName</a></li><li data-type='method'><a href="module-lib_util.html#~serviceRespond">serviceRespond</a></li></ul></li></ul><h3>Events</h3><ul><li><a href="HttpDuplex.html#event:close">close</a></li><li><a href="HttpDuplex.html#event:data">data</a></li><li><a href="HttpDuplex.html#event:drain">drain</a></li><li><a href="HttpDuplex.html#event:end">end</a></li><li><a href="HttpDuplex.html#event:error">error</a></li><li><a href="Git.html#event:fetch">fetch</a></li><li><a href="Git.html#event:head">head</a></li><li><a href="Git.html#event:info">info</a></li><li><a href="Git.html#event:push">push</a></li><li><a href="Git.html#event:tag">tag</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getType">getType</a></li></ul>
</nav>

<div id="main">
    
    <h1 class="page-title">HttpDuplex</h1>
    

    




<section>

<header>
    
        <h2>
        HttpDuplex
        </h2>
        
    
</header>

<article>
    <div class="container-overview">
    
        

    

    <h4 class="name" id="HttpDuplex"><span class="type-signature"></span>new HttpDuplex<span class="signature">(input, output)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line4">line 4</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/http.html#http_event_request">request</a></li>
        
            <li><a href="https://nodejs.org/api/http.html#http_class_http_incomingmessage">http.IncomingMessage</a></li>
        
            <li><a href="https://nodejs.org/api/http.html#http_class_http_serverresponse">http.ServerResponse</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Constructs a proxy object over input and output resulting in a unified stream.
Generally meant to combine request and response streams in the http.request event</p>
</div>









    <h5>Example</h5>
    
        <p class="code-caption">A simple example is shown below</p>
    
    <pre class="prettyprint"><code>http.createServer(function (req, res) {
    var dup = new HttpDuplex(req, res);
    res.end("Request: " + req.method + " " + req.url);
}).listen(80);</code></pre>




    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>input</code></td>
            

            <td class="type">
            
                
<span class="param-type">http.IncomingMessage</span>


            
            </td>

            

            

            <td class="description last"><p>client request object from request event</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>output</code></td>
            

            <td class="type">
            
                
<span class="param-type">http.ServerResponse</span>


            
            </td>

            

            

            <td class="description last"><p>response object from request event</p></td>
        </tr>

    
    </tbody>
</table>




<h5>Requires:</h5>
<ul>
    <li>module:events</li>
</ul>













    
    </div>

    
        <h3 class="subsection-title">Extends</h3>

        


    <ul>
        <li>EventEmitter</li>
    </ul>


    

    
        <h3 class="subsection-title">Requires</h3>

        <ul>
            <li>module:events</li>
        </ul>
    

    

     

    

    
        <h3 class="subsection-title">Members</h3>

        
            
<h4 class="name" id="headers"><span class="type-signature">(readonly) </span>headers<span class="type-signature"> :Object</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line76">line 76</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/http.html#http_message_headers">message.headers</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Request/response headers. Key-value pairs of header names and values. Header names are always lower-case.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Object</span>


        </li>
    </ul>






        
            
<h4 class="name" id="connection"><span class="type-signature">(readonly) </span>connection<span class="type-signature"> :net.Socket</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line72">line 72</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/http.html#http_request_socket">request.Socket</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Reference to the underlying socket for the request connection.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">net.Socket</span>


        </li>
    </ul>






        
            
<h4 class="name" id="method"><span class="type-signature">(readonly) </span>method<span class="type-signature"> :String</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line136">line 136</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/http.html#http_event_request">request</a></li>
        
            <li><a href="https://nodejs.org/api/http.html#http_class_http_serverresponse">http.ServerResponse</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Request method of the incoming request.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">String</span>


        </li>
    </ul>





    <h5>Example</h5>
    
    <pre class="prettyprint"><code>'GET', 'DELETE'</code></pre>



        
            
<h4 class="name" id="readable"><span class="type-signature">(readonly) </span>readable<span class="type-signature"> :Boolean</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line145">line 145</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Is this stream readable.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Boolean</span>


        </li>
    </ul>






        
            
<h4 class="name" id="req"><span class="type-signature"></span>req<span class="type-signature"> :http.IncomingMessage</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line33">line 33</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/http.html#http_event_request">request</a></li>
        
            <li><a href="https://nodejs.org/api/http.html#http_class_http_incomingmessage">http.IncomingMessage</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>A IncomingMessage created by http.Server or http.ClientRequest usually passed as the
first parameter to the 'request' and 'response' events. Implements Readable Stream interface
but may not be a decendant thereof.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">http.IncomingMessage</span>


        </li>
    </ul>






        
            
<h4 class="name" id="res"><span class="type-signature"></span>res<span class="type-signature"> :http.ServerResponse</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line42">line 42</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/http.html#http_event_request">request</a></li>
        
            <li><a href="https://nodejs.org/api/http.html#http_class_http_serverresponse">http.ServerResponse</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Created http.server. Passed as the second parameter to the 'request' event.
The response implements Writable Stream interface but isn't a descendent thereof.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">http.ServerResponse</span>


        </li>
    </ul>






        
            
<h4 class="name" id="socket"><span class="type-signature">(readonly) </span>socket<span class="type-signature"> :net.Socket</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line155">line 155</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/net.html#net_class_net_socket">net.Socket</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>net.Socket object associated with the connection.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">net.Socket</span>


        </li>
    </ul>






        
            
<h4 class="name" id="statusCode"><span class="type-signature"></span>statusCode<span class="type-signature"> :Number</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line166">line 166</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-default">Default Value:</dt>
    <dd class="tag-default"><ul class="dummy">
            <li>200</li>
        </ul></dd>
    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/http.html#http_response_statuscode">response.statusCode</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>The HTTP status code. Generally assigned before sending headers for a response to a client.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Number</span>


        </li>
    </ul>





    <h5>Example</h5>
    
    <pre class="prettyprint"><code>request.statusCode = 404;</code></pre>



        
            
<h4 class="name" id="statusMessage"><span class="type-signature"></span>statusMessage<span class="type-signature"> :String</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line182">line 182</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-default">Default Value:</dt>
    <dd class="tag-default"><ul class="dummy">
            <li>undefined</li>
        </ul></dd>
    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/http.html#http_response_statusmessage">response.statusMessage</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Controls the status message sent to the client as long as an explicit call to response.writeHead() isn't made
If ignored or the value is undefined, the default message corresponding to the status code will be used.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">String</span>


        </li>
    </ul>





    <h5>Example</h5>
    
    <pre class="prettyprint"><code>request.statusMessage = 'Document Not found';</code></pre>



        
            
<h4 class="name" id="trailers"><span class="type-signature">(readonly) </span>trailers<span class="type-signature"> :Object</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line190">line 190</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="HttpDuplex.html#headers">headers</a></li>
        
            <li><a href="HttpDuplex.html#addTrailers">addTrailers</a></li>
        
            <li><a href="https://nodejs.org/api/http.html#http_message_trailers">message.trailers</a></li>
        
            <li><a href="https://nodejs.org/api/http.html#http_response_addtrailers_headers">response.addTrailers</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Request/response trailer headers. Just like <a href="HttpDuplex.html#headers"><code>headers</code></a> except these are only written
after the initial response to the client.
This object is only populated at the 'end' event and only work if a 'transfer-encoding: chunked'
header is sent in the initial response.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Object</span>


        </li>
    </ul>






        
            
<h4 class="name" id="upgrade"><span class="type-signature">(readonly) </span>upgrade<span class="type-signature"> :Boolean</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line213">line 213</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/http.html#http_event_upgrade_1">upgrade</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Whether or not the client connection has been upgraded</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Boolean</span>


        </li>
    </ul>






        
            
<h4 class="name" id="url"><span class="type-signature">(readonly) </span>url<span class="type-signature"> :String</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line226">line 226</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Request URL string.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">String</span>


        </li>
    </ul>





    <h5>Examples</h5>
    
        <p class="code-caption">A request made as:</p>
    
    <pre class="prettyprint"><code>GET /info?check=none HTTP/1.1</code></pre>

        <p class="code-caption">Will return the string</p>
    
    <pre class="prettyprint"><code>'/info?check=none'</code></pre>



        
            
<h4 class="name" id="httpVersion"><span class="type-signature">(readonly) </span>httpVersion<span class="type-signature"> :String</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line89">line 89</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/http.html#http_message_httpversion">message.httpVersion</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Requested HTTP Version sent by the client. Usually either '1.0' or '1.1'</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">String</span>


        </li>
    </ul>






        
            
<h4 class="name" id="httpVersionMajor"><span class="type-signature">(readonly) </span>httpVersionMajor<span class="type-signature"> :Number</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line102">line 102</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="HttpDuplex.html#httpVersion">httpVersion</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>First integer in the httpVersion string</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Number</span>


        </li>
    </ul>






        
            
<h4 class="name" id="httpVersionMinor"><span class="type-signature">(readonly) </span>httpVersionMinor<span class="type-signature"> :String</span></h4>





<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line115">line 115</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="HttpDuplex.html#httpVersion">httpVersion</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Second integer ni the httpVersion string</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">String</span>


        </li>
    </ul>






        
    

    
        <h3 class="subsection-title">Methods</h3>

        
            

    

    <h4 class="name" id="addTrailers"><span class="type-signature"></span>addTrailers<span class="signature">(headers)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line378">line 378</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li>trailers</li>
        
            <li><a href="HttpDuplex.html#headers">headers</a></li>
        
            <li><a href="https://nodejs.org/api/http.html#http_message_trailers">message.trailers</a></li>
        
            <li><a href="https://nodejs.org/api/http.html#http_response_addtrailers_headers">response.addTrailers</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Adds trailing headers to the response.
Trailers will only be emitted if chunked encoding is enabled for the response; otherwise they are discarded.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>headers</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last"><p>Trailing headers to add to the response</p></td>
        </tr>

    
    </tbody>
</table>
















        
            

    

    <h4 class="name" id="cork"><span class="type-signature"></span>cork<span class="signature">()</span><span class="type-signature"> &rarr; {this}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line257">line 257</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="HttpDuplex.html#uncork">uncork</a></li>
        
            <li><a href="https://nodejs.org/api/stream.html#stream_writable_cork">stream.Writeable.cork</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Buffers written data in memory. This data will be flushed when either the uncork or end methods are called.</p>
</div>









    <h5>Example</h5>
    
    <pre class="prettyprint"><code>request.cork();
request.write('buffer data ');
request.write('before sending ');
request.uncork();</code></pre>
















<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">this</span>


    </dd>
</dl>

    


        
            

    

    <h4 class="name" id="destroy"><span class="type-signature"></span>destroy<span class="signature">()</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line308">line 308</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
</dl>





<div class="description">
    <p>Destroys object and it's bound streams</p>
</div>

























        
            

    

    <h4 class="name" id="end"><span class="type-signature"></span>end<span class="signature">(data, encoding, callback)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line392">line 392</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/http.html#http_response_end_data_encoding_callback">response.end</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Tells the server the response headers and body have been sent and that the message should be considered complete.
This MUST be called on every response.
If data is specified, this behaves as if calling response.write(data, encoding) followed by response.end(callback).
If specified, the callback is called once the response stream is finished.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>data</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>
|

<span class="param-type">Buffer</span>


            
            </td>

            

            

            <td class="description last"><p>optional data to write to the response before closing the connection</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>encoding</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>Encoding that should be used to write the data</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>callback</code></td>
            

            <td class="type">
            
                
<span class="param-type">function</span>


            
            </td>

            

            

            <td class="description last"><p>Function to be called once the response stream is finished</p></td>
        </tr>

    
    </tbody>
</table>
















        
            

    

    <h4 class="name" id="getHeader"><span class="type-signature"></span>getHeader<span class="signature">(name)</span><span class="type-signature"> &rarr; {String}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line406">line 406</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/http.html#http_request_getheader_name">getHeader</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Returns the current value of a header; name is case insensitive.</p>
</div>









    <h5>Example</h5>
    
    <pre class="prettyprint"><code>let contentType = request.getHeader('Content-Type');</code></pre>




    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>name</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>Header to get the value of</p></td>
        </tr>

    
    </tbody>
</table>














<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">String</span>


    </dd>
</dl>

    


        
            

    

    <h4 class="name" id="pause"><span class="type-signature"></span>pause<span class="signature">()</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line418">line 418</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/stream.html#stream_readable_pause">stream.Readable.pause</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Switch readable stream out of flowing mode and stop emitting 'data' events.
Any new data that becomes available during this time will stay buffered until resume is called.</p>
</div>

























        
            

    

    <h4 class="name" id="removeHeader"><span class="type-signature"></span>removeHeader<span class="signature">(name)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line427">line 427</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/http.html#http_request_removeheader_name">removeHeader</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Remove a header from the response headers.</p>
</div>









    <h5>Example</h5>
    
    <pre class="prettyprint"><code>request.removeHeader('Content-Type');</code></pre>




    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>name</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>Header to remove</p></td>
        </tr>

    
    </tbody>
</table>
















        
            

    

    <h4 class="name" id="resume"><span class="type-signature"></span>resume<span class="signature">()</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line438">line 438</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/stream.html#stream_readable_resume">stream.Readable.resume</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Switch readable stream back into flowing mode and restart emitting 'data' events.
This can be used to consume all data waiting without processing any of it.</p>
</div>

























        
            

    

    <h4 class="name" id="setDefaultEncoding"><span class="type-signature"></span>setDefaultEncoding<span class="signature">(encoding)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line447">line 447</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="HttpDuplex.html#setEncoding">setEncoding</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Sets the character encoding for data written to the stream.</p>
</div>









    <h5>Example</h5>
    
    <pre class="prettyprint"><code>request.setDefaultEncoding('utf8');</code></pre>




    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>encoding</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>new character encoding</p></td>
        </tr>

    
    </tbody>
</table>
















        
            

    

    <h4 class="name" id="setEncoding"><span class="type-signature"></span>setEncoding<span class="signature">(encoding)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line457">line 457</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="HttpDuplex.html#setDefaultEncoding">setDefaultEncoding</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Sets the character encoding for data read from the stream.</p>
</div>









    <h5>Example</h5>
    
    <pre class="prettyprint"><code>request.setEncoding('utf8');</code></pre>




    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>encoding</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>new character encoding</p></td>
        </tr>

    
    </tbody>
</table>
















        
            

    

    <h4 class="name" id="setHeader"><span class="type-signature"></span>setHeader<span class="signature">(name, value)</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line467">line 467</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="HttpDuplex.html#removeHeader">removeHeader</a></li>
        
            <li><a href="https://nodejs.org/api/http.html#http_request_setheader_name_value">setHeader</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Set a single header. If the header already exists, it will be replaced.
It's possible to use an array of strings in place of value to send multiple headers with the same name.</p>
</div>









    <h5>Examples</h5>
    
        <p class="code-caption">Single value</p>
    
    <pre class="prettyprint"><code>request.setHeader('Content-Type', 'text/html');</code></pre>

        <p class="code-caption">Array of string value</p>
    
    <pre class="prettyprint"><code>request.setHeader('Set-Cookie', ['type=auth', 'language=javascript']);</code></pre>




    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>name</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"><p>Header to set</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>value</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>
|

<span class="param-type">Array.&lt;string></span>


            
            </td>

            

            

            <td class="description last"><p>Value(s) to assign to header</p></td>
        </tr>

    
    </tbody>
</table>
















        
            

    

    <h4 class="name" id="uncork"><span class="type-signature"></span>uncork<span class="signature">()</span><span class="type-signature"> &rarr; {this}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line276">line 276</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="HttpDuplex.html#cork">cork</a></li>
        
            <li><a href="https://nodejs.org/api/stream.html#stream_writable_uncork">stream.Writeable.uncork</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Flushes all data buffered since cork() was called.</p>
</div>























<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">this</span>


    </dd>
</dl>

    


        
            

    

    <h4 class="name" id="write"><span class="type-signature"></span>write<span class="signature">(chunk, encoding<span class="signature-attributes">opt</span>, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line483">line 483</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/http.html#http_response_write_chunk_encoding_callback">http.ServerResponse.write</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Sends a chunk of the response body. This method may be called multiple times to provide successive parts of the
body.</p>
<p><p><em>Note:</em> If write() is called either before writeHead() or writeHead() just hasn't been called, it will switch * modes and flush the implicit headers that may be waiting before parts of this chunk are sent.<p/>
Node will buffer up to the first chunk of the body. Any additional calls to write() may be buffered as well
for packet efficiency purposes.</p>
Returns true if the entire data was flushed successfully to the kernel buffer. Returns false if all or part of
the data was buffered in memory.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>chunk</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>
|

<span class="param-type">Buffer</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>chunk of data to send.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>encoding</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    <code>'utf8'</code>
                
                </td>
            

            <td class="description last"><p>If chunk is a string, this specifies how to encode it into a byte stream.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>callback</code></td>
            

            <td class="type">
            
                
<span class="param-type">function</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>Callback to call when this chunk of data is flushed.</p></td>
        </tr>

    
    </tbody>
</table>






<h5>Fires:</h5>
<ul>
    <li>event:<a href="HttpDuplex.html#event:drain"><code>drain</code></a> Emitted when data was buffered and the buffer has become free for use again.</li>
</ul>









<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Boolean</span>


    </dd>
</dl>

    


        
            

    

    <h4 class="name" id="writeContinue"><span class="type-signature"></span>writeContinue<span class="signature">()</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line502">line 502</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/http.html#http_response_writecontinue">response.writeContinue</a>
<a href="https://nodejs.org/api/http.html#http_event_checkcontinue">http.Server/checkContinue</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Sends an HTTP/1.1 100 Continue message to the client.</p>
</div>

























        
            

    

    <h4 class="name" id="writeHead"><span class="type-signature"></span>writeHead<span class="signature">(statusCode, statusMessage<span class="signature-attributes">opt</span>, headers<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {this}</span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line235">line 235</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/http.html#http_response_writehead_statuscode_statusmessage_headers">response.writeHead</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Sends a response header to the client request. Must only be called one time and before calling response.end().</p>
</div>









    <h5>Example</h5>
    
    <pre class="prettyprint"><code>var content = 'Under Construction...';
response.writeHead(200, {
    'Content-Length': Buffer.byteLength(content),
    'Content-Type': 'text/plain' 
});
response.end(content);</code></pre>




    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>statusCode</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            

            <td class="description last"><p>3-digit HTTP status code, like 404</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>statusMessage</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An optional human readable status message to send with the status code</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>headers</code></td>
            

            <td class="type">
            
                
<span class="param-type">object</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An object containing the response headers to send</p></td>
        </tr>

    
    </tbody>
</table>














<h5>Returns:</h5>

        


<dl class="param-type">
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">this</span>


    </dd>
</dl>

    


        
            

    

    <h4 class="name" id="writeHeader"><span class="type-signature"></span>writeHeader<span class="signature">()</span><span class="type-signature"></span></h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line511">line 511</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    
        <dt class="important tag-deprecated">Deprecated:</dt><dd><ul class="dummy"><li><a href="https://nodejs.org/api/deprecations.html#deprecations_dep0063_serverresponse_prototype_writeheader">Node Deprecated</a></li></ul></dd>
    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="HttpDuplex.html#writeHead">writeHead</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p><strong>Warning:</strong> This has been deprecated in node, <strong>don't</strong> use it. Any apis that require this funtion should be
updated to use writeHead insted.</p>
</div>

























        
    

    

    
        <h3 class="subsection-title">Events</h3>

        
            

    

    <h4 class="name" id="event:close">close</h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line321">line 321</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="HttpDuplex.html#end">end</a></li>
        
            <li><a href="https://nodejs.org/api/http.html#http_event_close_2">http.IncomingMessage/close</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>Event emitted when the underlying request connection is closed. This only occurs once per response.</p>
</div>

























        
            

    

    <h4 class="name" id="event:data">data</h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line330">line 330</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/stream.html#stream_event_data">stream.Readable/data</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>This event is emitted when data on the stream can be consumed. This may occur whenever the stream is switched into
flowing mode by calling readable.pipe() or readable.resume() or by attaching a listener this event.<p/>
This event is emitted when readable.read() is called and a chunk of data becomes available.
Data will be passed as a string if the default encoding has been set using readable.setEncoding(); otherwise it's
passed as a Buffer.</p>
</div>











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>chunk</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>
|

<span class="param-type">buffer</span>
|

<span class="param-type">any</span>


            
            </td>

            

            

            <td class="description last"><p>The chunk is either a buffer or string when the stream isn't operating
       in object mode. When the stream is in object mode, the chunk can be any JavaScript value other than null.</p></td>
        </tr>

    
    </tbody>
</table>
















        
            

    

    <h4 class="name" id="event:drain">drain</h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line344">line 344</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/stream.html#stream_event_drain">stream.Writable/drain</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>If a call to response.write(chunk) returns false, the drain event will be emitted once it is appropriate to
resume writing data to the stream.</p>
</div>

























        
            

    

    <h4 class="name" id="event:end">end</h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line353">line 353</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/stream.html#stream_event_end">stream.Readable/end</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>This event is emitted once no more consumable data is left on the readable stream.<p/>
<em>Note</em>: This is only emitted when all data is completely consumed.</p>
</div>

























        
            

    

    <h4 class="name" id="event:error">error</h4>

    




<dl class="details">

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="http-duplex.js.html">http-duplex.js</a>, <a href="http-duplex.js.html#line362">line 362</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-see">See:</dt>
    <dd class="tag-see">
        <ul>
            <li><a href="https://nodejs.org/api/stream.html#stream_event_error_1">stream.Readable/error</a></li>
        
            <li><a href="https://nodejs.org/api/stream.html#stream_event_error">stream.Writeable/error</a></li>
        </ul>
    </dd>
    

    
</dl>





<div class="description">
    <p>This event may be emitted one of the underlying Readable or Writable stream implementations at any time.
This may happen in the following cases:</p>
<ul>
<li>if the underlying streams are unable to produce data because of an internal failure</li>
<li>if an attempt is made to push an invalid chunk of data.</li>
<li>if an error occurred while writing or piping data.<p/></li>
</ul>
<p>The listener callback will be passed a single Error object.<br/>
<em>Note</em>: Streams are not closed when the event is emitted.</p>
</div>

























        
    
</article>

</section>




</div>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>